package com.ocom.payhandle.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.typehandler.EntityCcbBusinessInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 智慧生活商家信息 Mapper 接口
 * </p>
 *
 * @author js
 * @since 2023-10-04
 */
@Mapper
public interface IDaoCcbBusinessInfo extends BaseMapper<EntityCcbBusinessInfo> {
    @Select({"<script>",
                "SELECT b.merch_id AS merchId , b.business_name AS businessName , m.merch_name AS merchName " +
                        "FROM `ccb_business_info` AS b LEFT JOIN `xf_merchant_info` AS m ON b.com_id = m.com_id AND b.merch_id = m.merch_id " +
                        "WHERE b.com_id = #{comId}  " +
                        "AND (b.merch_id = #{merchId}  OR FIND_IN_SET(#{merchId}, m.merch_orgin) > 0)"+
            "</script>"})
    EntityCcbBusinessInfo checkMerchInfo(@Param("comId")Long comId, @Param("merchId")Long merchId);
}
